

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    transition: opacity 0.3s;
}

/* Loading Screen */
#loading-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #111, #1a1a2e);
}

#loading-screen-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('../Art/background/OnTheShip.webp');
    background-size: cover;
    background-position: center;
    opacity: 0.35;
    z-index: 0;
}

#loading-screen-character {
    display: none;
    position: absolute;
    bottom: -5%;
    left: 15%;
    width: 40vw;
    height: 90vh;
    background-image: url('../Art/character/Lyra.webp');
    background-size: contain;
    background-position: bottom center;
    background-repeat: no-repeat;
    z-index: 1;
    pointer-events: none;
    filter: drop-shadow(10px 10px 20px rgba(0,0,0,0.8));
}

#loading-screen .ui-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2;
    pointer-events: none; /* Let clicks pass through to interactive elements */
}
#loading-screen .ui-layer > * {
    pointer-events: auto; /* Re-enable clicks for children */
}

#title-display {
    position: absolute;
    top: 40px;
    left: 40px;
    color: #fff;
    font-size: 3rem;
    font-family: 'Cinzel', serif;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.8), 2px 2px 4px rgba(0,0,0,0.8);
    margin: 0;
    z-index: 2;
    letter-spacing: 2px;
}

.lang-select {
    position: absolute;
    top: 100px;
    left: 45px;
    z-index: 2;
    display: flex;
    gap: 10px;
}

/* Arknights Style Menu Container */
#menu-main {
    position: absolute;
    left: auto;
    right: 5%;
    top: 50%;
    transform: translateY(-50%) perspective(1000px) rotateY(-15deg);
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 400px;
    align-items: flex-end;
    transform-style: preserve-3d;
    background: none;
    border: none;
    padding: 0;
    box-shadow: none;
}

#menu-main > button {
    width: 100%;
    height: 90px;
    background: rgba(20, 20, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 6px solid var(--accent-purple);
    color: #fff;
    text-align: left;
    padding: 15px 30px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: -5px 10px 20px rgba(0,0,0,0.5);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 15px 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#menu-main > button .btn-title {
    font-size: 1.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 4px;
    line-height: 1;
}

#menu-main > button .btn-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 5px;
}

#menu-main > button::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: all 0.5s ease;
}

#menu-main > button:hover {
    transform: translateX(-10px) translateZ(20px);
    background: rgba(40, 30, 50, 0.9);
    border-right-color: var(--accent-pink);
    box-shadow: -15px 20px 30px rgba(0,0,0,0.7);
    color: var(--accent-pink);
}

#menu-main > button:hover::before {
    left: 100%;
}

#menu-main > button::after {
    content: '▶';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    font-size: 1.2rem;
    transition: opacity 0.3s;
}

#menu-main > button:hover::after {
    opacity: 1;
    color: var(--accent-pink);
}

/* Secondary menus also need to look consistent, maybe just centered for now */
.menu-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 11, 21, 0.95);
    padding: 30px;
    border: 1px solid var(--accent-purple);
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

.menu-container.hidden {
    display: none !important;
}

#menu-levels, #menu-gallery, #menu-level-config {
    /* Uses base .menu-container styling */
}


/* NEW: Wide container for Team Management */
.menu-container-wide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    width: 92vw;
    max-width: 1300px;
    height: 85vh;
    max-height: 760px;
    background: rgba(18, 15, 26, 0.96);
    padding: 24px 30px;
    border: 1px solid var(--accent-purple, #7c3aed);
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), 0 0 25px rgba(124, 58, 237, 0.25);
    backdrop-filter: blur(10px);
}

.team-layout {
    display: flex;
    gap: 20px;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.team-panel {
    flex: 1;
    background: #0f0b15;
    border: 1px solid #332b45;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.team-panel h4 {
    margin: 0 0 10px 0;
    color: var(--accent-yellow);
    border-bottom: 1px solid #332b45;
    padding-bottom: 8px;
}

/* Roster Grid (Left) */
.roster-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 columns */
    grid-auto-rows: 105px;
    gap: 12px;
    overflow-y: auto;
    padding-right: 6px;
    flex: 1;
}

/* Squad Grid (Right) */
.squad-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns */
    grid-template-rows: repeat(4, 1fr); /* 4 rows */
    gap: 12px;
    height: 100%;
    flex: 1;
}

/* Character Detail Panel Styling */
.detail-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    background: #110e19;
    border: 1px solid #7c3aed;
    border-radius: 8px;
    overflow-y: auto;
    height: 100%;
    color: #e2e8f0;
    position: relative;
}

.detail-panel.hidden {
    display: none !important;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #332d42;
    padding-bottom: 8px;
}

.detail-char-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-char-title img {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
    object-position: top;
    border: 1px solid #fbbf24;
    background: #000;
}

.detail-char-names {
    display: flex;
    flex-direction: column;
}

.detail-char-name {
    font-size: 1.15rem;
    font-weight: bold;
    color: #fbbf24;
}

.detail-char-role {
    font-size: 0.7rem;
    color: #94a3b8;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn-close-detail {
    background: #27272a;
    border: 1px solid #52525b;
    color: #f1f5f9;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close-detail:hover {
    background: #dc2626;
    border-color: #ef4444;
    color: #ffffff;
}

/* 1. 五维属性 Stats Grid */
.detail-section-title {
    font-size: 0.8rem;
    font-weight: bold;
    color: #38bdf8;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
}

.stats-five-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.stat-box {
    background: #181424;
    border: 1px solid #2e2640;
    border-radius: 4px;
    padding: 4px 2px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-bottom: 2px;
    font-weight: bold;
}

.stat-val {
    font-size: 0.95rem;
    font-weight: bold;
    color: #f8fafc;
}

/* 2. 3+3 技能组 Skill Grid */
.skills-grid-6 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 6px;
}

.skill-card-slot {
    background: #181424;
    border: 1px solid #3b3252;
    border-radius: 4px;
    padding: 6px 8px;
    position: relative;
    cursor: help;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 48px;
}

.skill-card-slot:hover {
    border-color: #a855f7;
    background: #231c36;
}

.skill-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.skill-slot-name {
    font-size: 0.75rem;
    font-weight: bold;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-badge {
    font-size: 0.55rem;
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: bold;
    flex-shrink: 0;
}

.skill-badge.active {
    background: #9333ea;
    color: #fff;
}

.skill-badge.passive {
    background: #2563eb;
    color: #fff;
}

.skill-badge.weapon {
    background: #dc2626;
    color: #fff;
}

.skill-badge.item {
    background: #16a34a;
    color: #fff;
}

.skill-badge.armor {
    background: #0284c7;
    color: #fff;
}

.skill-card-slot.item-slot {
    border-color: #059669;
    background: #0f1f1a;
}

.skill-card-slot.item-slot:hover {
    border-color: #34d399;
    background: #132a23;
}

.skill-slot-type {
    font-size: 0.6rem;
    color: #64748b;
    margin-top: 2px;
}

/* Floating Tooltip */
.skill-tooltip {
    position: fixed;
    z-index: 9999;
    background: rgba(15, 11, 25, 0.95);
    border: 1px solid #a855f7;
    border-radius: 6px;
    padding: 10px 14px;
    max-width: 280px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.85);
    pointer-events: none;
    display: none;
}

.skill-tooltip-title {
    font-size: 0.85rem;
    font-weight: bold;
    color: #fbbf24;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.skill-tooltip-desc {
    font-size: 0.75rem;
    color: #cbd5e1;
    line-height: 1.4;
}

/* 3. 3个框 (1 Costume Box + 2 Item Boxes) */
.equip-three-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 6px;
}

.equip-box {
    background: #181424;
    border: 1px solid #3b3252;
    border-radius: 4px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    min-height: 68px;
}

.equip-box-title {
    font-size: 0.65rem;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.btn-swap-skin {
    background: #3b0764;
    border: 1px solid #a855f7;
    color: #f0abfc;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.btn-swap-skin:hover {
    background: #581c87;
    color: #ffffff;
}

.btn-swap-skin.locked {
    background: #27272a;
    border-color: #52525b;
    color: #71717a;
    cursor: not-allowed;
}

.equip-box-content {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.equip-box-img {
    width: 30px;
    height: 30px;
    border-radius: 3px;
    object-fit: cover;
    background: #0f0b15;
    border: 1px solid #4c1d95;
}

.equip-box-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.equip-box-name {
    font-size: 0.75rem;
    font-weight: bold;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.equip-box-sub {
    font-size: 0.6rem;
    color: #94a3b8;
    line-height: 1.2;
}

.equip-box.unequipped {
    opacity: 0.72;
    border-style: dashed;
}

.equip-box.unequipped .equip-box-name {
    color: #cbd5e1;
}

.skill-card-slot.unequipped {
    opacity: 0.55;
}

.btn-toggle-module {
    white-space: nowrap;
}

/* 4. 人物介绍 (4 Paragraphs) */
.detail-bio-section {
    background: #181424;
    border: 1px solid #2e2640;
    border-radius: 4px;
    padding: 8px 10px;
    max-height: 180px;
    overflow-y: auto;
}

.bio-paragraph {
    font-size: 0.72rem;
    color: #cbd5e1;
    line-height: 1.45;
    margin-bottom: 8px;
    text-indent: 0;
    word-break: break-word;
}

.bio-paragraph:last-child {
    margin-bottom: 0;
}

/* Card Styles */
.char-card {
    background: #1f1f22;
    border: 1px solid #444;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}

.char-card:hover {
    border-color: var(--accent-purple);
    background: #27272a;
}

.char-card img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    object-position: top; /* Changed from center to top to show faces */
    border-radius: 4px;
    margin-bottom: 5px;
    pointer-events: none; /* Important for Drag */
}

.char-card span {
    font-size: 0.75rem;
    color: #ccc;
    pointer-events: none;
}

.char-card.locked {
    opacity: 0.4;
    cursor: default;
    background: #111;
}

.char-card.dragging {
    opacity: 0.5;
    border-color: var(--accent-yellow);
}

.squad-slot {
    background: #18181b;
    border: 1px dashed #444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.2s;
}

.squad-slot.drag-over {
    background: rgba(139, 92, 246, 0.2); /* Purple tint */
    border-color: var(--accent-purple);
    border-style: solid;
}

/* When a card is inside a slot, make it fill the slot */
.squad-slot .char-card {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}


/* Level Config */
#menu-level-config {
    background: rgba(15, 11, 21, 0.95);
    padding: 30px;
    border: 1px solid var(--accent-purple);
    border-radius: 8px;
    gap: 20px;
}

.config-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-section label {
    color: var(--accent-purple);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.config-select {
    background: #000;
    border: 1px solid #444;
    color: #fff;
    padding: 10px;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.config-select:focus {
    border-color: var(--accent-purple);
    outline: none;
}

.config-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
    margin-top: 10px;
}

.btn-primary {
    padding: 15px 40px;
    font-size: 1.25rem;
    background: #7f1d1d;
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.4);
    width: 300px;
}

.btn-primary:hover {
    background: #991b1b;
}

.btn-secondary {
    background: transparent;
    border: 1px solid #3f3f46;
    color: #94a3b8;
    width: 250px;
}

.btn-secondary:hover {
    border-color: var(--accent-purple);
    color: white;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.btn-level {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent-purple);
    background: #1e1b29;
    font-weight: bold;
}

.btn-level:hover:not(.disabled) {
    background: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple);
}

.btn-level.disabled {
    border-color: #3f3f46;
    color: #3f3f46;
    cursor: default;
    background: #0f0b15;
}

/* Game Layout */
.layout {
    display: flex;
    width: 100%;
    height: 100vh; /* Force full viewport height */
    overflow: hidden;
}

/* New Left Panel */
.left-panel {
    width: 280px;
    background: #09090b;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 30;
    flex-shrink: 0;
}

/* Center Map */
.map-section {
    flex: 1;
    position: relative;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}

/* Right Controls */
.control-panel {
    width: 380px;
    background: var(--panel-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
}

@media (max-width: 1200px) {
    .left-panel { display: none; } /* Hide log on smaller screens or make draggable */
    .control-panel { width: 300px; }
}

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .control-panel { width: 100%; height: 40vh; }
    .left-panel { width: 100%; height: 150px; border-right: none; border-bottom: 1px solid var(--border-color); }
}

/* Global Buff Containers */
.global-buff-container {
    position: absolute;
    top: 52px; /* Below top-bar */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 12px;
    z-index: 50;
    max-width: 45%;
}

.global-buff-container.left {
    left: 10px;
}

.global-buff-container.right {
    right: 10px;
    justify-content: flex-end;
}

.global-buff-item {
    background: rgba(30, 30, 40, 0.9);
    border: 1px solid var(--accent-purple);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
}
